﻿using System;
using Microsoft.Office.PowerPoint.STAMP.Properties;

namespace Microsoft.Office.PowerPoint.STAMP.Core
{
    /// <summary>
    /// Updates a progress form when all captions are removed from a slide.
    /// </summary>
    public class RemoveCaptionsProgressObserverWithForm : IProgressObserver
    {
        private readonly Progress _form;

        /// <summary>
        /// Initializes a new instance of the <see cref="RemoveCaptionsProgressObserverWithForm"/> class.
        /// </summary>
        /// <param name="captionCount">The caption count.</param>
        public RemoveCaptionsProgressObserverWithForm(int captionCount)
        {
            _form = new Progress(captionCount);
            _form.Show();
            _form.Update(1, Resources.CCAIRibbon_RemoveCaptionsOnAction_DeleteAnimations_Phase_one_of_deleting_captions);
        }

        public void Dispose()
        {
            _form.Close();
            _form.Dispose();
        }

        public void Update(int progressIndex)
        {
            
            switch (progressIndex)
            {
                case 1: 
                    _form.Update(33, Resources.CCAIRibbon_RemoveCaptionsOnAction_DeleteBookmarks_Phase_two_of_deleting_captions);
                    break;
                case 2:
                    _form.Update(66, Resources.CCAIRibbon_RemoveCaptionsOnAction_DeleteShapes_Phase_three_of_deleting_captions);
                    break;
                case 3:
                    _form.Update(99, Resources.CCAIRibbon_RemoveCaptionsOnAction_DeleteShapes_Phase_four_of_deleting_captions);
                    break;
            }
        }
    }
}